Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #77 by changing the library’s stream transformation model so CSV decoding/encoding streams emit one row per event, eliminating the extra List<List<...>> nesting that appeared when using Stream.transform(...).toList() after upgrading to v7.
Changes:
- Refactors
CsvDecoderandCsvEncoderto beStreamTransformerBaseimplementations (row-per-event) while keeping batchconvert(...)-style APIs. - Introduces
Csvas the primary API (with deprecatedCsvCodectypedef) and addsasCodec()as adart:convertCodecadapter for.fuse()use cases. - Updates tests, examples, benchmarks, docs, changelog, and bumps package version to
8.0.0.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/src/csv_decoder.dart |
Refactors decoding to emit one row per stream event while preserving batch decode via convert(). |
lib/src/csv_encoder.dart |
Refactors encoding to accept one row per stream event and preserves batch encode via convert(). |
lib/src/csv_codec.dart |
Replaces CsvCodec class with Csv, adds encode/decode helpers and introduces asCodec() adapter. |
lib/csv.dart |
Updates top-level csv/excel instances to use Csv. |
test/csv_test.dart |
Updates chunked conversion tests to assert flat row emission and new encoder input types. |
test/small_chunk_test.dart |
Updates expectations to match row-per-event decoding (no manual flattening). |
test/parse_headers_test.dart |
Updates to construct Csv(parseHeaders: true) and keeps header parsing behavior tests. |
test/split_escape_test.dart |
Updates chunked decoding sink setup to collect row events directly. |
test/split_crlf_test.dart |
Same as above for CRLF chunking scenarios. |
test/multi_char_delim_test.dart |
Same as above for multi-character delimiter chunking scenarios. |
example/csv_fuse_example.dart |
Updates .fuse() example to use csv.asCodec() as the supported path. |
benchmark/benchmark_csv.dart |
Updates benchmark streams to use per-row events and uses asCodec() for fuse benchmarking. |
README.md |
Documents v8 upgrade, stream row-per-event behavior, and explains the Codec/asCodec() tradeoff. |
CHANGELOG.md |
Adds v8.0.0 entry describing the fix and breaking changes. |
pubspec.yaml |
Bumps version to 8.0.0 and updates package description. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Restructures the CSV API to fix issue #77 (“extra layer of []” when using stream.transform(csv.decoder).toList()) by making the decoder/encoder true stream transformers that emit one row per stream event, while preserving a dart:convert Codec pathway via asCodec().
Changes:
- Refactors
CsvDecoder/CsvEncoderintoStreamTransformerBaseimplementations (one row per event) to eliminateList<List<List<dynamic>>>nesting in stream usage. - Renames
CsvCodec→Csv(with deprecatedCsvCodectypedef) and addsCsv.asCodec()to supportCodec.fuse()and otherdart:convert-only APIs. - Updates docs, examples, benchmarks, and tests to the new stream semantics and
asCodec()usage; adds newasCodec()test coverage.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/src/csv_decoder.dart | Emits one decoded row per stream event; keeps batch convert() returning all rows. |
| lib/src/csv_encoder.dart | Emits one encoded row fragment per stream event; keeps batch convert() for full CSV output. |
| lib/src/csv_codec.dart | Introduces Csv as primary API, adds asCodec() adapter, deprecates CsvCodec name. |
| lib/csv.dart | Updates exported defaults (csv, excel) to be Csv instances. |
| README.md | Documents v8 upgrade, stream behavior, and asCodec() rationale/usage. |
| CHANGELOG.md | Adds v8.0.0 breaking changes and notes the stream nesting fix. |
| pubspec.yaml | Bumps version to 8.0.0 and updates package description. |
| example/csv_fuse_example.dart | Updates fuse example to use csv.asCodec(). |
| benchmark/benchmark_csv.dart | Updates benchmark to stream per-row events and use asCodec() for fuse benchmark. |
| test/csv_test.dart | Updates chunked conversion tests to new flat (row-per-event) stream behavior. |
| test/small_chunk_test.dart | Removes now-unnecessary unnesting in expectations for stream decoding. |
| test/parse_headers_test.dart | Migrates to Csv(parseHeaders: true) API. |
| test/split_escape_test.dart | Updates chunked sink usage for per-row emission. |
| test/split_crlf_test.dart | Updates chunked sink usage for per-row emission. |
| test/multi_char_delim_test.dart | Updates chunked sink usage for per-row emission. |
| test/as_codec_test.dart | Adds comprehensive tests for asCodec() behavior and batching controls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fixes #77